import request from '@/utils/request'
// -------------电邮/分享/点赞/收藏 点击数------------

//分享点击数接口  /doc/top/share
export const addDocTopShareApi = (id, type) => {
    if (type == '1') {
        return request({
            url: `/doc/law/share?id=${id}`,
            method: 'put',
        })
    } else if (type == '2') {
        return request({
            url: `/doc/qa/share?id=${id}`,
            method: 'put',
        })
    } else if (type == '3') {
        return request({
            url: `/doc/top/share?id=${id}`,
            method: 'put',
        })
    } else if (type == '4') {
        return request({
            url: `/doc/scontract/share?id=${id}`,
            method: 'put',
        })
    }
}

//电邮点击数接口 /doc/top/email
export const addDocTopEmailApi = (id, type) => {
    if (type == '1') {
        return request({
            url: `/doc/law/email?id=${id}`,
            method: 'put',
        })
    } else if (type == '2') {
        return request({
            url: `/doc/qa/email?id=${id}`,
            method: 'put',
        })
    } else if (type == '3') {
        return request({
            url: `/doc/top/email?id=${id}`,
            method: 'put',
        })
    } else if (type == '4') {
        return request({
            url: `/doc/scontract/email?id=${id}`,
            method: 'put',
        })
    }
}

// 获取点赞收藏接口数量  /service/docFavorites/clickStatus
export const addDocFavoritesApi = (id) => {
    return request({
        url: `/service/docFavorites/clickStatus?esId=${id}`,
        method: 'get',
    })
}

//收藏添加接口 /service/docFavorites/add
export const addFavoritesApi = (data) => {
    return request({
        url: '/service/docFavorites/add',
        method: 'post',
        data
    })
}
//取消收藏的接口 /service/docFavorites/remove
export const removeFavoritesApi = (data) => {
    return request({
        url: '/service/docFavorites/remove',
        method: 'delete',
        data
    })
}

//点赞添加接口 /work/like/add
export const addLikeApi = (data) => {
    return request({
        url: '/work/like/add',
        method: 'post',
        data
    })
}
//取消点赞接口 /work/like/remove
export const removeLikeApi = (data) => {
    return request({
        url: '/work/like/remove',
        method: 'delete',
        data
    })
}

//id查询
export const getTopInfoApi = (params) => {
    return request({
        url: '/doc/top/getInfo',
        method: 'get',
        params
    })
}